package mnstudent.dataacesslayer;

import mnstudent.datatranferobject.ScoreStudentDTO;

/**
 *
 * @author trungpv
 */
public class ScoresDAL {

    //<editor-fold defaultstate="collapsed" desc="Attributes">
    private ScoreStudentDTO m_ScoreStudentObj;
    private DataExecuteUseStoreProcedure m_DataExecute;
    private String m_sqlCmd;

    //</editor-fold>
    
      //<editor-fold defaultstate="collapsed" desc="Constuctor">
    public ScoresDAL() {
        this.m_ScoreStudentObj = new ScoreStudentDTO();
        this.m_DataExecute = new DataExecuteUseStoreProcedure();
        this.m_sqlCmd = "";
    }
   //</editor-fold>  
    
    public boolean insertScoreStudentDetail(ScoreStudentDTO scoreStudentObj) {
        try {
            m_sqlCmd = "{Call InsertScoreStudentToDatabase(?,?,?,?,?)}";
            String[] arrStr = {scoreStudentObj.getStudentID(), scoreStudentObj.getM_SubjectID(), scoreStudentObj.getM_YearID(), scoreStudentObj.getM_SemesterID(), scoreStudentObj.getScore().toString()};

            return this.m_DataExecute.updateDataToDatabase(m_sqlCmd, arrStr) > 0;

        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return false;
    }
    
}
